package control;

import calculator.Calculator;

/**
 * @author ouweijian
 * @date 2023/2/11 17:16
 */
public class ControlSelector {

    public static Control select(String input, Calculator calculator) {
        if ("=".equalsIgnoreCase(input)) {
            return new SumControl(calculator);
        } else if ("ac".equalsIgnoreCase(input)) {
            return new AcControl(calculator);
        } else if ("undo".equalsIgnoreCase(input)) {
            return new UndoControl(calculator);
        } else if ("redo".equalsIgnoreCase(input)) {
            return new RedoControl(calculator);
        }
        return null;
    }
}
